/*     */ package com.zimbra.cs.db;
/*     */ 
/*     */ import java.sql.PreparedStatement;
/*     */ import java.sql.ResultSet;
/*     */ import java.sql.SQLException;
/*     */ import org.apache.commons.dbcp.DelegatingConnection;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class RetryPreparedStatement
/*     */   extends DebugPreparedStatement
/*     */ {
/*     */   RetryPreparedStatement(DelegatingConnection conn, PreparedStatement stmt, String sql)
/*     */   {
/*  36 */     super(conn, stmt, sql);
/*     */   }
/*     */   
/*     */   public boolean execute() throws SQLException
/*     */   {
/*  41 */     AbstractRetry<Boolean> exec = new AbstractRetry()
/*     */     {
/*     */       public ExecuteResult<Boolean> execute() throws SQLException {
/*  44 */         return new ExecuteResult(Boolean.valueOf(RetryPreparedStatement.this.superExecute()));
/*     */       }
/*  46 */     };
/*  47 */     return ((Boolean)exec.doRetry().getResult()).booleanValue();
/*     */   }
/*     */   
/*     */   private boolean superExecute() throws SQLException {
/*  51 */     return super.execute();
/*     */   }
/*     */   
/*     */   public boolean execute(final String sql, final int autoGeneratedKeys)
/*     */     throws SQLException
/*     */   {
/*  57 */     AbstractRetry<Boolean> exec = new AbstractRetry()
/*     */     {
/*     */       public ExecuteResult<Boolean> execute() throws SQLException {
/*  60 */         return new ExecuteResult(Boolean.valueOf(RetryPreparedStatement.this.superExecute(sql, autoGeneratedKeys)));
/*     */       }
/*  62 */     };
/*  63 */     return ((Boolean)exec.doRetry().getResult()).booleanValue();
/*     */   }
/*     */   
/*     */   private boolean superExecute(String sql, int autoGeneratedKeys) throws SQLException {
/*  67 */     return super.execute(sql, autoGeneratedKeys);
/*     */   }
/*     */   
/*     */   public boolean execute(final String sql, final int[] columnIndexes) throws SQLException
/*     */   {
/*  72 */     AbstractRetry<Boolean> exec = new AbstractRetry()
/*     */     {
/*     */       public ExecuteResult<Boolean> execute() throws SQLException {
/*  75 */         return new ExecuteResult(Boolean.valueOf(RetryPreparedStatement.this.superExecute(sql, columnIndexes)));
/*     */       }
/*  77 */     };
/*  78 */     return ((Boolean)exec.doRetry().getResult()).booleanValue();
/*     */   }
/*     */   
/*     */   private boolean superExecute(String sql, int[] columnIndexes) throws SQLException {
/*  82 */     return super.execute(sql, columnIndexes);
/*     */   }
/*     */   
/*     */   public boolean execute(final String sql, final String[] columnNames)
/*     */     throws SQLException
/*     */   {
/*  88 */     AbstractRetry<Boolean> exec = new AbstractRetry()
/*     */     {
/*     */       public ExecuteResult<Boolean> execute() throws SQLException {
/*  91 */         return new ExecuteResult(Boolean.valueOf(RetryPreparedStatement.this.superExecute(sql, columnNames)));
/*     */       }
/*  93 */     };
/*  94 */     return ((Boolean)exec.doRetry().getResult()).booleanValue();
/*     */   }
/*     */   
/*     */   private boolean superExecute(String sql, String[] columnNames) throws SQLException {
/*  98 */     return super.execute(sql, columnNames);
/*     */   }
/*     */   
/*     */   public boolean execute(final String sql) throws SQLException
/*     */   {
/* 103 */     AbstractRetry<Boolean> exec = new AbstractRetry()
/*     */     {
/*     */       public ExecuteResult<Boolean> execute() throws SQLException {
/* 106 */         return new ExecuteResult(Boolean.valueOf(RetryPreparedStatement.this.superExecute(sql)));
/*     */       }
/* 108 */     };
/* 109 */     return ((Boolean)exec.doRetry().getResult()).booleanValue();
/*     */   }
/*     */   
/*     */   private boolean superExecute(String sql) throws SQLException {
/* 113 */     return super.execute(sql);
/*     */   }
/*     */   
/*     */   public int[] executeBatch() throws SQLException
/*     */   {
/* 118 */     AbstractRetry<int[]> exec = new AbstractRetry()
/*     */     {
/*     */       public ExecuteResult<int[]> execute() throws SQLException {
/* 121 */         return new ExecuteResult(RetryPreparedStatement.this.superExecuteBatch());
/*     */       }
/* 123 */     };
/* 124 */     return (int[])exec.doRetry().getResult();
/*     */   }
/*     */   
/*     */   private int[] superExecuteBatch() throws SQLException {
/* 128 */     return super.executeBatch();
/*     */   }
/*     */   
/*     */   public ResultSet executeQuery() throws SQLException
/*     */   {
/* 133 */     AbstractRetry<ResultSet> exec = new AbstractRetry()
/*     */     {
/*     */       public ExecuteResult<ResultSet> execute() throws SQLException {
/* 136 */         return new ExecuteResult(RetryPreparedStatement.this.superExecuteQuery());
/*     */       }
/* 138 */     };
/* 139 */     return (ResultSet)exec.doRetry().getResult();
/*     */   }
/*     */   
/*     */   private ResultSet superExecuteQuery() throws SQLException {
/* 143 */     return super.executeQuery();
/*     */   }
/*     */   
/*     */   public ResultSet executeQuery(final String sql) throws SQLException
/*     */   {
/* 148 */     AbstractRetry<ResultSet> exec = new AbstractRetry()
/*     */     {
/*     */       public ExecuteResult<ResultSet> execute() throws SQLException {
/* 151 */         return new ExecuteResult(RetryPreparedStatement.this.superExecuteQuery(sql));
/*     */       }
/* 153 */     };
/* 154 */     return (ResultSet)exec.doRetry().getResult();
/*     */   }
/*     */   
/*     */   private ResultSet superExecuteQuery(String sql) throws SQLException {
/* 158 */     return super.executeQuery(sql);
/*     */   }
/*     */   
/*     */   public int executeUpdate() throws SQLException
/*     */   {
/* 163 */     AbstractRetry<Integer> exec = new AbstractRetry()
/*     */     {
/*     */       public ExecuteResult<Integer> execute() throws SQLException {
/* 166 */         return new ExecuteResult(Integer.valueOf(RetryPreparedStatement.this.superExecuteUpdate()));
/*     */       }
/* 168 */     };
/* 169 */     return ((Integer)exec.doRetry().getResult()).intValue();
/*     */   }
/*     */   
/*     */   private int superExecuteUpdate() throws SQLException {
/* 173 */     return super.executeUpdate();
/*     */   }
/*     */   
/*     */   public int executeUpdate(final String sql, final int autoGeneratedKeys)
/*     */     throws SQLException
/*     */   {
/* 179 */     AbstractRetry<Integer> exec = new AbstractRetry()
/*     */     {
/*     */       public ExecuteResult<Integer> execute() throws SQLException {
/* 182 */         return new ExecuteResult(Integer.valueOf(RetryPreparedStatement.this.superExecuteUpdate(sql, autoGeneratedKeys)));
/*     */       }
/* 184 */     };
/* 185 */     return ((Integer)exec.doRetry().getResult()).intValue();
/*     */   }
/*     */   
/*     */   private int superExecuteUpdate(String sql, int autoGeneratedKeys) throws SQLException {
/* 189 */     return super.executeUpdate(sql, autoGeneratedKeys);
/*     */   }
/*     */   
/*     */   public int executeUpdate(final String sql, final int[] columnIndexes)
/*     */     throws SQLException
/*     */   {
/* 195 */     AbstractRetry<Integer> exec = new AbstractRetry()
/*     */     {
/*     */       public ExecuteResult<Integer> execute() throws SQLException {
/* 198 */         return new ExecuteResult(Integer.valueOf(RetryPreparedStatement.this.superExecuteUpdate(sql, columnIndexes)));
/*     */       }
/* 200 */     };
/* 201 */     return ((Integer)exec.doRetry().getResult()).intValue();
/*     */   }
/*     */   
/*     */   private int superExecuteUpdate(String sql, int[] columnIndexes) throws SQLException {
/* 205 */     return super.executeUpdate(sql, columnIndexes);
/*     */   }
/*     */   
/*     */   public int executeUpdate(final String sql, final String[] columnNames)
/*     */     throws SQLException
/*     */   {
/* 211 */     AbstractRetry<Integer> exec = new AbstractRetry()
/*     */     {
/*     */       public ExecuteResult<Integer> execute() throws SQLException {
/* 214 */         return new ExecuteResult(Integer.valueOf(RetryPreparedStatement.this.superExecuteUpdate(sql, columnNames)));
/*     */       }
/* 216 */     };
/* 217 */     return ((Integer)exec.doRetry().getResult()).intValue();
/*     */   }
/*     */   
/*     */   private int superExecuteUpdate(String sql, String[] columnNames) throws SQLException {
/* 221 */     return super.executeUpdate(sql, columnNames);
/*     */   }
/*     */   
/*     */   public int executeUpdate(final String sql) throws SQLException
/*     */   {
/* 226 */     AbstractRetry<Integer> exec = new AbstractRetry()
/*     */     {
/*     */       public ExecuteResult<Integer> execute() throws SQLException {
/* 229 */         return new ExecuteResult(Integer.valueOf(RetryPreparedStatement.this.superExecuteUpdate(sql)));
/*     */       }
/* 231 */     };
/* 232 */     return ((Integer)exec.doRetry().getResult()).intValue();
/*     */   }
/*     */   
/*     */   private int superExecuteUpdate(String sql) throws SQLException {
/* 236 */     return super.executeUpdate(sql);
/*     */   }
/*     */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/db/RetryPreparedStatement.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */